<template>
  <div class="order container">
    <header>
      <i class="iconfont icon-fanhui" @click="$router.back()"></i>
      <span>未付款</span>
      <i class="iconfont icon-kefu"></i>
    </header>
    <section>
      <div class="goods" v-if="daifuList.length !== 0">
        <ul>
          <li v-for="item in daifuList" :key="item.id">
            <div class="zhifu">
              <div class="dianpu" @click="home()">茶七网旗舰店 ></div>
            </div>
            <div class="goods-content">
              <h4 v-for="item1 in name">{{ item1 }}</h4>
              <div class="goods-total">x{{ item.num }}</div>
            </div>
            <div class="zongji">
              <p class="p1">{{ item.orderId }}</p>
              <p class="p2">合计：</p>

              <p class="price">￥{{ item.price }}</p>
            </div>
          </li>
        </ul>
      </div>

      <div class="else" v-else>
        <p>暂没有待支付订单</p>
        <div>
          <router-link to="/list">去逛逛吧</router-link>
        </div>
      </div>
    </section>
  </div>
</template>
<script>
import http from "@/common/api/request.js";
export default {
  data() {
    return {
      daifuList: [],
      name: "",
    };
  },

  created() {
    this.daifuList = [];
    this.getDaifu();
  },

  methods: {
    async getDaifu() {
      let res = await http.$axios({
        url: "http://127.0.0.1:3008/goods/noPayment",
      });
      this.daifuList = res.data;
      this.name = this.daifuList[0].name;
      this.name = this.name.split(",");
    },

    home() {
      this.$router.push({
        path: "/home",
      });
    },
  },
};
</script>

<style lang='scss' scoped>
.container {
  padding-right: 0px;
  padding-left: 0px;
  margin-right: auto;
  margin-left: auto;
  overflow: auto;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: 1.173333rem;
  color: #fff;
  background-color: #b0352f;
  i {
    padding: 0 0.4rem;
    font-size: 0.586666rem;
  }
  span {
    font-weight: 300;
    font-size: 0.48rem;
  }
}
section {
  overflow: auto;
  background-color: #f7f7f7;
  margin-bottom: 51px;
  padding-bottom: 151px;
}
.goods {
  padding: 0.16rem 0.4rem;
  margin-top: 0.4rem;
  font-size: 0.426666rem;
  background-color: #ffffff;
  ul {
    width: 100%;
    li {
      border-bottom: 1px solid #ccc;
      .zhifu {
        display: flex;
        margin-top: 20px;
        color: #000000;
        .pay {
          margin-left: 179px;
          margin-top: -1px;
        }
      }
    }
    .goods-content {
      flex: 1;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      padding-left: 0.4rem;

      h4 {
        margin-top: 18px;
        font-size: 15px;
        color: #212121;
        font-weight: 400;
      }
    }
  }
  .goods-total {
    margin-left: 297px;
    margin-top: 20px;
  }

  .zongji {
    margin-top: 18px;
    font-size: 15px;
    display: flex;
    margin-left: 243px;
    margin-bottom: 15px;

    p.p1 {
      margin-left: -228px;
      margin-right: 53px;
    }

    .price {
      color: #b0352f;
      font-weight: bold;
      margin-left: 3px;
    }
  }
}

.else {
  p {
    margin-top: 217px;
    font-size: 15px;
    margin-left: 3px;
    text-align: -webkit-center;
    color: #7f7f7f;
  }
  div {
    margin-top: 70px;
    a {
      color: #5b5b5b;
      margin-left: 153px;
      font-size: 26px;
    }
  }
}
</style>
